package com.ellwood.copyright.infrastructure.system.vo;

import com.ellwood.copyright.common.core.annotation.ExcelFieldConverter;
import com.ellwood.copyright.common.core.annotation.ExcelHeader;
import com.ellwood.copyright.common.core.utils.EllDateUtils;
import com.ellwood.copyright.common.core.utils.excel.FieldConverterUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @ProjectName: ell-copyright-pro
 * @PackageName: com.ellwood.copyright.infrastructure.vo.system
 * @ClassName: SysUserVO
 * @Description: // 用户实体VO
 * @Author: Ellwood
 * @CreateDate: 2024/11/21 - 17:51
 * @Version: V1.0.0
 */
@Data
@Schema(description = "用户查询vo")
public class SysUserDataVO implements Serializable {

    @Serial
    private static final long serialVersionUID = 7387722654284090808L;

    @ExcelHeader("编号")
    @Schema(description = "用户id")
    private Long userId ;

    @ExcelHeader("账号")
    @Schema(description = "账号")
    @NotBlank(message = "账号不能为空")
    private String account ;

    @ExcelHeader("真实姓名")
    @Schema(description = "真实姓名")
    private String nickName ;

    @ExcelHeader("年龄")
    @Schema(description = "年龄")
    private Integer age ;

    @ExcelHeader("性别")
    @ExcelFieldConverter(converter = FieldConverterUtil.class) //使用通用转换器
    @Schema(description = "性别：0：男 1：女")
    @Range(min = 0, max = 1,message = "性别不正确")
    private Integer gender ;

    @ExcelHeader("头像")
    @Schema(description = "头像")
    private String avatar ;

    @ExcelHeader("邮箱")
    @Schema(description = "邮箱")
    @Email(message = "邮箱格式不正确")
    private String email ;

    @ExcelHeader("手机号")
    @Schema(description = "手机号")
    @NotBlank(message = "手机号不能为空")
    private String phone ;

    @ExcelHeader("生日")
    @Schema(description = "生日")
    private Date birthday ;

    @ExcelHeader("工资")
    @Schema(description = "工资")
    private Double isMoney ;

    @ExcelHeader("备注")
    @Schema(description = "备注")
    private String isRemark ;

    @ExcelHeader("用户状态")
    @ExcelFieldConverter(converter = FieldConverterUtil.class)
    @Schema(description = "状态：0：正常 1：锁定 ")
    @Range(min = 0, max = 1, message = "用户状态不正确")
    private Integer isState ;

    @ExcelHeader("创建时间")
    @Schema(description = "创建时间")
    @JsonFormat(pattern = EllDateUtils.DATE_TIME_PATTERN)
    private LocalDateTime createTime ;

}
